<template>
	<view>
		<view v-if="info">
			<view>{{ info.title }}</view>
			<hr>
			<view>{{ info.content }}</view>
		</view>
		<view v-else>找不到数据</view>
	</view>
</template>

<script setup lang="ts">
import { useShare } from "@/hooks";
import { request } from "@/lib";
import { api } from "@/api";
import { Article } from "@/types/service/article";
import { ApiCode } from "@/types/api/base";
const props = defineProps<{
	id: string
}>()

const { args: shareArgs } = useShare({
	title: '文章标题',
	path: "/pages/article/article-detail/article-detail",
	imageUrl: '',
	params: {
		id: props.id
	}
});

/**文章详情 */
const info = ref<Article>()
const getInfo = async (id: string) => {
	// const res = await request<{
	// 	info: Article
	// }>({
	// 	url: api.article.info,
	// 	method: 'GET',
	// 	params: { id }
	// })
	// if (res.code === ApiCode.success) {
	// 	info.value = res.data.info
	// }
}
if (props.id) {
	getInfo(props.id)
}

onReachBottom(() => {
	// getMore();
})

// #ifdef MP
onShareAppMessage(() => {
	return shareArgs
})
// #endif
</script>

<style scoped lang="scss"></style>
